package demoMod.stsconsole.cards.red;

import demoMod.stsconsole.cards.AbstractCard;
import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.helpers.DamageInfo;
import demoMod.stsconsole.powers.WeakPower;

public class Clothesline extends AbstractCard {
    public static final String ID = "Clothesline";

    public Clothesline() {
        super(ID);
        this.baseDamage = 12;
        this.color = CardColor.RED;
        this.cost = 2;
        this.rarity = CardRarity.COMMON;
        this.type = CardType.ATTACK;
        this.target = CardTarget.ENEMY;
        this.magicNumber = 2;
    }

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.baseDamage += 2;
            this.upgraded = true;
            this.name = this.name + "+";
            this.upgradeTimes++;
            this.magicNumber++;
        }
    }

    @Override
    public boolean use(AbstractPlayer p, AbstractCreature target) {
        if (target != null) {
            target.damage(new DamageInfo(this.damage, p));
            target.applyPower(p, new WeakPower(target, this.magicNumber));
        }
        return true;
    }
}
